package com.yuanchu.goods.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yuanchu.common.validator.ValidationGroups;
import com.yuanchu.goods.entity.YoshopUploadFileEntity;
import lombok.Data;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * @version: 1.0
 * @Author: adan
 * @description: 封装返回商品详情类
 * @Modified By:
 * @date: 2023-12-23 1:29
 */
@Data
@ToString
public class QueryGoodsDetail implements Serializable {
    /**
     * 记录ID
     */
    @TableId
    private Integer id;
    @JsonProperty("goods_image")
    private String goodsImage;
    @JsonProperty("goods_sales")
    private Integer goodsSales;
    /**
     * 商品ID
     */
    @NotNull(groups = {ValidationGroups.Update.class, ValidationGroups.Delete.class}, message = "修改必须指定商品id")
    @Null(groups = {ValidationGroups.Insert.class}, message = "新增不能指定id")
    @TableId
    @JsonProperty("goods_id")
    private Integer goodsId;
    /**
     * 商品名称
     */
    @NotBlank(groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class}, message = "商品名必须提交")    //不能是null和""和"  "
    @JsonProperty("goods_name")
    private String goodsName;
    /**
     * 商品编码
     */
    @NotBlank(groups = {ValidationGroups.Insert.class}, message = "商品编码必须提交")
    @JsonProperty("goods_no")
    private String goodsNo;
    /**
     * 主图视频ID
     */
    @JsonProperty("video_id")
    private Integer videoId;
    /**
     * 主图视频ID
     */
    @JsonProperty("video_cover_id")
    private Integer videoCoverId;
    /**
     * 商品卖点
     */
    @JsonProperty("selling_point")
    private String sellingPoint;
    /**
     * 商品规格(10单规格 20多规格)
     */
    @JsonProperty("spec_type")
    private Integer specType;
    /**
     * 商品价格(最低)
     */
    @JsonProperty("goods_price_min")
    private String goodsPriceMin;
    /**
     * 商品价格(最高)
     */
    @JsonProperty("goods_price_max")
    private String goodsPriceMax;
    /**
     * 划线价格(最低)
     */
    @JsonProperty("line_price_min")
    private String linePriceMin;
    /**
     * 划线价格(最高)
     */
    @JsonProperty("line_price_max")
    private String linePriceMax;
    /**
     * 库存总量(包含所有sku)
     */
    @JsonProperty("stock_total")
    private Integer stockTotal;
    /**
     * 库存计算方式(10下单减库存 20付款减库存)
     */
    @JsonProperty("deduct_stock_type")
    private Integer deductStockType;
    /**
     * 商品详情
     */
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private String content;
    /**
     * 初始销量
     */
    @JsonProperty("sales_initial")
    private Integer salesInitial;
    /**
     * 实际销量
     */
    @JsonProperty("sales_actual")
    private Integer salesActual;
    /**
     * 配送模板ID
     */
    @JsonProperty("delivery_id")
    private Integer deliveryId;
    /**
     * 是否开启积分赠送(1开启 0关闭)
     */
    @JsonProperty("is_points_gift")
    private Integer isPointsGift;
    /**
     * 是否允许使用积分抵扣(1允许 0不允许)
     */
    @JsonProperty("is_points_discount")
    private Integer isPointsDiscount;
    /**
     * 积分抵扣设置(0默认抵扣 1单独设置抵扣)
     */
    @JsonProperty("is_alone_points_discount")
    private Integer isAlonePointsDiscount;
    /**
     * 单独设置积分抵扣的配置
     */
    @JsonProperty("points_discount_config")
    private String pointsDiscountConfig;
    /**
     * 是否开启会员折扣(1开启 0关闭)
     */
    @JsonProperty("is_enable_grade")
    private Integer isEnableGrade;
    /**
     * 会员折扣设置(0默认等级折扣 1单独设置折扣)
     */
    @JsonProperty("is_alone_grade")
    private Integer isAloneGrade;

    /**
     * 商品状态(10上架 20下架)
     */
    private Integer status;
    /**
     * 排序(数字越小越靠前)
     */
    private Integer sort;
    /**
     * 是否删除
     */
    @JsonProperty("is_delete")
    private Integer isDelete;
    /**
     * 商城ID
     */
    @JsonProperty("store_id")
    private Integer storeId;
    /**
     * 创建时间
     */
    @JsonProperty("create_time")
    private String createTime;
    /**
     * 更新时间
     */
    @JsonProperty("update_time")
    private String updateTime;




    @TableField(exist = false)
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private GoodsSkuDto skuInfo;

    @Accessors(chain = true)
    @JsonProperty("alone_grade_equity")
    private Map<String, Double> aloneGradeEquity;
    private List<Integer> categoryIds;
    private List<SpecData.SpecList> specList;
    private List<Integer> serviceIds;
    private boolean isSpecLocked;
    private List<GoodsSkuDto> skuList;
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private YoshopUploadFileEntity video;
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private YoshopUploadFileEntity videoCover;
    @JsonProperty("goods_images")
    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    private List<YoshopUploadFileEntity> goodsImages;

}
